<#
 #   It is recommended to test the script on a local machine for its purpose and effects. 
 #   ManageEngine Endpoint Central will not be responsible for any 
 #   damage/loss to the data/setup based on the behavior of the script.

 #   Description: Script is designed To Remove the folder details under the controlled folder access allowed application option under MS Defender.
 #   Configuration Type - COMPUTER
 #   Refer: https://learn.microsoft.com/en-us/powershell/module/defender/remove-mppreference?view=windowsserver2022-ps&viewFallbackFrom=win10-ps
 #   Article: https://www.tenforums.com/tutorials/5924-add-remove-microsoft-defender-antivirus-exclusions-windows-10-a.html
 #   Limitation: If Microsoft Defender is disabled or another antivirus program is enabled, it may not be effective.
 #>

 # Full path of the file or folder to exclude
$ExclusionPath = "C:\TestFileorFolderPath" #Enter the full path of the file or folder to exclude it needs to be hardcoded

# Add the exclusion to Windows Defender
Remove-MpPreference -ExclusionPath $ExclusionPath -Force

Write-Host "Exclusion path removed successfully: $ExclusionPath"